package cn.buk.tms.dao;


import cn.buk.common.sc.CommonSearchCriteria;
import cn.buk.tms.dto.PnrSummary;
import cn.buk.tms.entity.misc.*;

import java.util.Date;
import java.util.List;

public interface PnrDao {

  Pnr getPnrByPnrNo(String pnrNo, int enterpriseId);

  Pnr getPnrById(int id);

  List<Pnr> search(int enterpriseId, CommonSearchCriteria sc);

  List<Pnr> search(int enterpriseId, int maxResults);

  List<Pnr> search(int enterpriseId, String segStatus, int segCount);

  /**
   * 查收checktime超过24小时的pnr
   *
   * @param enterpriseId
   * @param max
   * @return
   */
  List<Pnr> searchCheckTimeMoreThan24Hours(int enterpriseId, int max);

  /**
   * 保存新记录
   *
   *
   * @param enterpriseId
   * @param pnr
   * @return
   */
  int createOrUpdate(int enterpriseId, Pnr pnr);


  int delete(int id, PnrLog log);

  int getPnrStatusCount(String pnrStatus, String etermUsername, int enterpriseId);

  int delete(int id, int enterpriseId, int userId);

  List<PnrLog> searchPnrLog(int enterpriseId, CommonSearchCriteria sc);

  List<Pnr> searchPnr(int enterpriseId, Date departureDate, String flightNo, String subClass);

  int deleteInvalidPnr(int enterpriseId, Date departureDate, String flightNo, String subClass, String pnrNo, int userId);

  int savePnrLog(int enterpriseId, String pnrNo, String pnrDetail, String remark);

  List<FareCondition> searchFareConditions(int enterpriseId, CommonSearchCriteria sc);


  int create(PnrAlert alert);

  List<PnrAlert> searchPnrAlert(int enterpriseId, int alertType, CommonSearchCriteria sc);

  List<Pnr> searchPnrXX();

  List<Pnr> searchPnrOtherOffice(String officeNo);

  List<PnrUsed> searchPnrUsed(int enterpriseId, CommonSearchCriteria sc);

  int savePnrMonitor(int enterpriseId, String pnr, int monitorType);

  /**
   * 查找用于CTCM/CTCM项目的手机号
   *
   * @param enterpriseId
   * @return
   */
  String applyCtcmMobile(int enterpriseId, Integer mobileUsage);

  /**
   * 查找旅行代码
   *
   * @param enterpriseId
   * @param carrier
   * @return
   */
  PnrTourCode searchTourCode(int enterpriseId, String carrier);

  List<PnrSummary> statPnrByUsername(int enterpriseId, CommonSearchCriteria sc);

  List<Pnr> searchPnrCtcm(int enterpriseId, String carrier, String etermUsername, int minCreatedMinutes, Integer ctcmCount, CommonSearchCriteria sc);

  List<Pnr> searchPnrCtct(int enterpriseId, CommonSearchCriteria sc);

  List<PnrMobile> searchPnrMobile(int enterpriseId, CommonSearchCriteria sc);

  int createPnrMobile(int enterpriseId, String mobile);

  int deletePnrMobile(int enterpriseId, int id);

  /**
   * 保存Q信息
   * @param qinfo
   * @return
   */
  int createQinfo(Qinfo qinfo);
}
